home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util1
/
wgrab.lha
/
wshotiff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-10-30
|
2KB
|
82 lines
/* $Id$
*/
#include <intuition/IntuitionBase.h>
#include <graphics/GfxBase.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <clib/alib_protos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/macros.h>
#include <stdlib.h>
#include <libraries/iff.h>
char *MYLIBNAME="iff.library";
extern struct IntuitionBase *IntuitionBase;
extern struct Library *IFFBase;
struct picdata {
struct BitMap *bitmap;
ULONG *colortable;
};
void
SavePicture(Object *Picture,const STRPTR FileName)
{
struct picdata *data=(struct picdata *)Picture;
if (!IFFL_SaveBitMap(FileName,data->bitmap,(WORD *)data->colortable,1)) {
printf("Error On Saving");
}
}
Object *
GetPicture(BOOL scr)
{
struct picdata *data=(struct picdata *)malloc(sizeof(struct picdata));
ULONG IntuiLock;
struct Window *Window;
BOOL Locked=TRUE;
struct Screen *Screen;
LONG NumColours;
IntuiLock=LockIBase(NULL);
if(!scr) {
Window = IntuitionBase -> ActiveWindow;
data->bitmap=Window->RPort->BitMap;
}
else {
Screen = IntuitionBase -> ActiveScreen;
data->bitmap=Screen->RastPort.BitMap;
}
NumColours = ((scr)?(Screen -> ViewPort . ColorMap -> Count):(Window -> WScreen -> ViewPort . ColorMap -> Count));
if(data->colortable=(ULONG *)malloc(sizeof(ULONG)*3*NumColours)) {
GetRGB32(((scr)?(Screen -> ViewPort . ColorMap):(Window -> WScreen -> ViewPort . ColorMap)),0,NumColours,
data->colortable);
UnlockIBase(IntuiLock);
Locked=FALSE;
return((Object *)data);
}
}